<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script src="./Promise.js"></script>
  <script>
    let p = new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve('OKOKOK');
      }, 1000)
    });
    
    let result = p.then(
      value => {
        console.log(value);
        // return 123;
        // throw 'Error';
        // return new Promise((resolve, reject) => {
          // resolve('OOO');
          // reject('NoNoNo')
        // })
      }, 
      reason => {
        console.log(reason);
        // return 123;
        // return new Promise((resolve,reject) => {
        //   // resolve(123);
        //   reject('error');
        // })
        // throw 123;
      });

    console.log(result);
  </script>
</body>

</html>